home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscTableScroll / MiscHighlightTracker.M < prev    next >
Encoding:
Text File  |  1996-02-11  |  3.1 KB  |  102 lines

  1. //=============================================================================
  2. //
  3. //        Copyright (C) 1995 by Paul S. McCarthy and Eric Sunshine.
  4. //                Written by Paul S. McCarthy and Eric Sunshine.
  5. //                            All Rights Reserved.
  6. //
  7. //        This notice may not be removed from this source code.
  8. //
  9. //        This object is included in the MiscKit by permission from the authors
  10. //        and its use is governed by the MiscKit license, found in the file
  11. //        "License.rtf" in the MiscKit distribution.    Please refer to that file
  12. //        for a list of all applicable permissions and restrictions.
  13. //        
  14. //=============================================================================
  15. //-----------------------------------------------------------------------------
  16. // MiscHighlightTracker.M
  17. //
  18. //        Highlight-mode selection tracking.
  19. //
  20. //-----------------------------------------------------------------------------
  21. //-----------------------------------------------------------------------------
  22. // $Id: MiscHighlightTracker.M,v 1.1 95/09/27 12:21:21 zarnuk Exp $
  23. // $Log:        MiscHighlightTracker.M,v $
  24. //    Revision 1.1  95/09/27    12:21:21  zarnuk
  25. //    Initial revision
  26. //    
  27. //-----------------------------------------------------------------------------
  28. #import "MiscHighlightTracker.h"
  29. #import "MiscSparseSet.h"
  30. #import "MiscTableBorder.h"
  31.  
  32.  
  33. @implementation MiscHighlightTracker
  34.  
  35. //-----------------------------------------------------------------------------
  36. // setLastPos:
  37. //-----------------------------------------------------------------------------
  38. - (void) setLastPos: (MiscCoord_V) pos
  39.     {
  40.     lastPos = pos;
  41.     set->setCursor( pos );
  42.     }
  43.  
  44.  
  45. //-----------------------------------------------------------------------------
  46. // mouseDown:atPos:
  47. //-----------------------------------------------------------------------------
  48. - (void) mouseDown: (NXEvent const*) event atPos: (MiscCoord_V) pos
  49.     {
  50.     extending = ((event->flags & NX_ALTERNATEMASK) != 0);
  51.     if (extending)
  52.         {
  53.         [super mouseDown: event atPos: pos];
  54.         }
  55.     else
  56.         {
  57.         set->toggle( pos );
  58.         [self setLastPos: pos];
  59.         }
  60.     }
  61.  
  62.  
  63. //-----------------------------------------------------------------------------
  64. // mouseDragged:atPos:
  65. //-----------------------------------------------------------------------------
  66. - (void) mouseDragged: (NXEvent const*) event atPos: (MiscCoord_V) pos
  67.     {
  68.     if (extending)
  69.         {
  70.         [super mouseDragged: event atPos: pos];
  71.         }
  72.     else
  73.         {
  74.         if (lastPos >= 0 && lastPos < border->count())
  75.             set->toggle( lastPos );
  76.         if (pos >= 0 && pos < border->count())
  77.             set->toggle( pos );
  78.         [self setLastPos: pos];
  79.         }
  80.     }
  81.  
  82.  
  83. //-----------------------------------------------------------------------------
  84. // mouseUp:atPos:
  85. //-----------------------------------------------------------------------------
  86. - (void) mouseUp: (NXEvent const*) event atPos: (MiscCoord_V) pos
  87.     {
  88.     if (extending)
  89.         [super mouseUp: event atPos: pos];
  90.     }
  91.  
  92.  
  93. //-----------------------------------------------------------------------------
  94. // keyDown:atPos:
  95. //-----------------------------------------------------------------------------
  96. - (void) keyDown: (NXEvent const*) event atPos: (MiscCoord_V) pos
  97.     {
  98.     set->toggle( pos );
  99.     }
  100.  
  101. @end
  102.